package com.justnow.offer;


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author justnow
 * Created on 2020-09-06
 * Description
 */
public class TencentSolution03 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<Integer>();
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            int temp = scanner.nextInt();
            list.add(temp);
            arr[i] = temp;
        }

        list.sort((x1, x2) -> x1 - x2);
        int size = list.size();
        list.remove(size - 1);
        int newSize = list.size();
        int middle = newSize / 2;
        int first = list.get(middle);
        int second = list.get(middle + 1);

        for (int i = 0; i < size; i++) {
            if (arr[i] > first)
                System.out.println(first);
            else
                System.out.println(second);
        }
    }
}
